
    <!-- form start -->
    <form action="{{url('admin/type')}}" method="post" id="myaddform" class="form-horizontal">
      <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
      <div class="box-body">
        <div class="form-group">
          <label for="inputEmail3" class="col-sm-3 control-label">商品板块：</label>
          <div class="col-sm-4" class="form-control">
            <select name="fid" id="fid" class="form-control">
                <option value="0">所属板块</option>
                @foreach($list1 as $v)
                    <option value="{{$v->id}}">{{$v->name}}</option>
                @endforeach
            </select>
          </div>
        </div>
		<div id="mid"></div>
		<script src="{{asset('myadmin/bootstrap/js/jquery-3.1.0.js')}}" type="text/javascript"></script>
		<script type="text/javascript">
			$(function(){
				function str_repeat(str, num){ 
					return new Array( num + 1 ).join( str ); 
				}
				$(function(){
					$("#fid").click(function(){
						pid.length=1;
						$("#gd").css("display","block");
						$.ajax({
							url:'{{url("admin/type")}}/'+$(this).val(),
							type:"get",
							dataType:"json",
							async:true,
							success:function(res){
								for(var i=0;i<res.length;i++){
									//创建一个下拉项，并添加到cid中
									n = parseInt(res[i][1].split("=>")[1]) - 1;
									n = n * 2;
									m = '|--'+new Array(n + 1).join("-")+res[i][0].split("=>")[1];
									pid.add(new Option(m,parseInt(res[i][0])));
								}
							},
						});
					});					
				})
			});		
		</script>
        <div class="form-group" id="gd" style="display:none;">
          <label for="inputEmail3" class="col-sm-3 control-label">父类别名：</label>
          <div class="col-sm-4" class="form-control">
            <select name="pid" id="pid" class="form-control">
                <option value="0">下级类别</option>
                @foreach($list as $v)
                    <option value="{{$v->id}}">{{$v->name}}</option>
                @endforeach
            </select>
          </div>
        </div>
        <div class="form-group">
          <label for="inputPassword3" class="col-sm-3 control-label">类别名称：</label>
          <div class="col-sm-4">
            <input type="text" class="form-control" id="inputPassword3" placeholder="类别名称" name="name">
          </div>
        </div>
      </div><!-- /.box-body -->
    </form>
				